//
//  ZZStatusCellBottomView.swift
//  SinaWeibo
//
//  Created by QUAN on 15/11/17.
//  Copyright © 2015年 QUAN. All rights reserved.
//

import UIKit

class ZZStatusCellBottomView: UIView {

    
    @objc private func retweetedBtnDidClcik() {
        
        let temp = ZZTempViewController()
        
        retweetedBtn.NavController()?.pushViewController(temp, animated: true)
        
    }
    
    // MARK: 重构方法
    override init(frame: CGRect) {
        super.init(frame: frame)
        setUpUi()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    // MARK: 设置UI
    private func setUpUi() {
        backgroundColor = UIColor(white: 0.98, alpha: 1)
        
        addSubview(retweetedBtn)
        addSubview(composeBtn)
        addSubview(likeBtn)
        
        let w: CGFloat = 0.5
        let scale = 0.4
        
        retweetedBtn.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(snp_left)
            make.top.equalTo(snp_top)
            make.height.equalTo(snp_height)
        }
        
        let sepView1 = sepView()
        addSubview(sepView1)
        sepView1.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(retweetedBtn.snp_right)
            make.height.equalTo(retweetedBtn.snp_height).multipliedBy(scale)
            make.centerY.equalTo(self.snp_centerY)
            make.width.equalTo(w)
        }
        
        composeBtn.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(retweetedBtn.snp_right)
            make.top.equalTo(snp_top)
            make.width.equalTo(retweetedBtn.snp_width)
            make.height.equalTo(snp_height)
        }
        let sepView2 = sepView()
        addSubview(sepView2)
        sepView2.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(composeBtn.snp_right)
            make.height.equalTo(composeBtn.snp_height).multipliedBy(scale)
            make.centerY.equalTo(self.snp_centerY)
            make.width.equalTo(w)
        }
        likeBtn.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(composeBtn.snp_right)
            make.right.equalTo(snp_right)
            make.top.equalTo(snp_top)
            make.height.equalTo(snp_height)
            make.width.equalTo(composeBtn.snp_width)
        }
        
        retweetedBtn.addTarget(self, action: "retweetedBtnDidClcik", forControlEvents: .TouchUpInside)
        
    }
    
    // MARK: 懒加载控件
    
    private func sepView() -> UIView {
       
        let v = UIView()
        
        v.backgroundColor = UIColor.darkGrayColor()
        
        return v
        
    }
    
    
    private lazy var retweetedBtn:UIButton = UIButton(title: "转发", image: "timeline_icon_retweet", backImage: nil, color: UIColor.darkGrayColor(),size:10)
    private lazy var composeBtn: UIButton = UIButton(title: "评论", image: "timeline_icon_comment", backImage: nil, color: UIColor.darkGrayColor(),size: 10)
    private lazy var likeBtn: UIButton = UIButton(title: "赞", image: "timeline_icon_unlike", backImage: nil, color: UIColor.darkGrayColor(),size: 10)
    
}
